Imports System.IO

Module ReadBinaryData

    Sub Main()
        Dim Stream As FileStream
        Stream = New FileStream("C:\File.dat",  FileMode.Open)

        Dim BinaryStream As New BinaryReader(Stream)

        Dim Age As Integer
        Dim Salary As Double
        Dim Name As String

        Try
            Age = BinaryStream.ReadInt32()
            Salary = BinaryStream.ReadDouble()
            Name = BinaryStream.ReadString()
            BinaryStream.Close()

            Console.WriteLine("Age: {0}", Age)
            Console.WriteLine("Salary: {0}", Salary)
            Console.WriteLine("Name: {0}", Name)
        Catch E As Exception
            Console.WriteLine("Loi doc du lieu")
            Console.WriteLine("Error {0}", E.Message)
        End Try

        Console.ReadLine() 

    End Sub
End Module